package com.example.demo.service.impl;

import com.example.demo.mapper.RoomMapper;
import com.example.demo.vo.InsertActivityVo;
import org.apache.tomcat.util.json.JSONParser;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import springfox.documentation.spring.web.json.Json;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Service
public class RoomServiceImple {
    @Resource
    private RoomMapper roomMapper;

    public Map<String, Object> selectActAll() {
        Map<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("msg","成功获取数据");
        map.put("data", this.roomMapper.selectActAll());
        return map;
    }
    public Map<String, Object> deleteById(int id) {
        Map<String, Object> map = new HashMap<>();
        map.put("code", 200);
        map.put("id",id);
        map.put("msg",this.roomMapper.deleteById(id) > 0 ? "删除成功" : "删除失败");
        return map;
    }
    public Map<String, Object> insertActivity(InsertActivityVo insertActivityVo) {
        Map<String, Object> map = new HashMap<>();
        this.roomMapper.insertActivity(insertActivityVo);
        map.put("code", 200);
        map.put("data", insertActivityVo);
        map.put("msg", "新增成功");
        return map;
    }
}
